package com.lwj.liwanjia.presenter;

import com.lwj.liwanjia.bean.AllMoneyBean;
import com.lwj.liwanjia.impl.AllMoneyView;
import com.lwj.liwanjia.model.AllMoneyModel;

import rx.Subscriber;

/**
 * Created by Administrator on 2018/1/18.
 */

public class AllMoeyPresenter {
    private AllMoneyModel allMoneyModel;
    private AllMoneyView allMoneyView;

    public AllMoeyPresenter(AllMoneyView allMoneyView) {
        this.allMoneyView = allMoneyView;
        allMoneyModel = new AllMoneyModel();
    }

    public void getAllMoey(String token) {
        allMoneyModel.getAllMoney(token, new Subscriber<AllMoneyBean>() {
            @Override
            public void onCompleted() {

            }

            @Override
            public void onError(Throwable e) {
                allMoneyView.showError((Exception) e);
            }

            @Override
            public void onNext(AllMoneyBean allMoneyBean) {
                allMoneyView.getAllMoney(allMoneyBean);
            }
        });
    }
}
